﻿<%@ Page Title="" Language="C#" MasterPageFile="~/user/MasterPage2.master" AutoEventWireup="true" CodeFile="Choose.aspx.cs" Inherits="user_Choose" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="商品编号" DataSourceID="SqlDataSource1" Width="938px">
        <Columns>
            <asp:ImageField DataImageUrlField="图片" HeaderText="商品图片" ReadOnly="True">
                <ControlStyle Height="200px" Width="200px" />
            </asp:ImageField>
            <asp:BoundField DataField="商品名称" HeaderText="商品名称" SortExpression="商品名称" />
            <asp:BoundField DataField="价格" HeaderText="价格" SortExpression="价格" />
            <asp:BoundField DataField="商品编号" HeaderText="商品编号" ReadOnly="True" SortExpression="商品编号" Visible="False" />
            <asp:BoundField DataField="数量" HeaderText="数量" SortExpression="数量" Visible="False" />
            <asp:BoundField DataField="图片" HeaderText="图片" SortExpression="图片" Visible="False" />
            <asp:BoundField DataField="商品类型" HeaderText="商品类型" SortExpression="商品类型" Visible="False" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="false" CommandName="" OnClick="Button1_Click" OnClientClick="javascript:return confirm('已添加');" Text="添加购物车" CommandArgument='<%# Eval("商品编号") %>'/>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:keshe2ConnectionString %>" DeleteCommand="DELETE FROM [商品] WHERE [商品编号] = @original_商品编号 AND [商品名称] = @original_商品名称 AND [数量] = @original_数量 AND (([图片] = @original_图片) OR ([图片] IS NULL AND @original_图片 IS NULL)) AND [价格] = @original_价格 AND [商品类型] = @original_商品类型" InsertCommand="INSERT INTO [商品] ([商品编号], [商品名称], [数量], [图片], [价格], [商品类型]) VALUES (@商品编号, @商品名称, @数量, @图片, @价格, @商品类型)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [商品]" UpdateCommand="UPDATE [商品] SET [商品名称] = @商品名称, [数量] = @数量, [图片] = @图片, [价格] = @价格, [商品类型] = @商品类型 WHERE [商品编号] = @original_商品编号 AND [商品名称] = @original_商品名称 AND [数量] = @original_数量 AND (([图片] = @original_图片) OR ([图片] IS NULL AND @original_图片 IS NULL)) AND [价格] = @original_价格 AND [商品类型] = @original_商品类型">
        <DeleteParameters>
            <asp:Parameter Name="original_商品编号" Type="String" />
            <asp:Parameter Name="original_商品名称" Type="String" />
            <asp:Parameter Name="original_数量" Type="Int32" />
            <asp:Parameter Name="original_图片" Type="String" />
            <asp:Parameter Name="original_价格" Type="Double" />
            <asp:Parameter Name="original_商品类型" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="商品编号" Type="String" />
            <asp:Parameter Name="商品名称" Type="String" />
            <asp:Parameter Name="数量" Type="Int32" />
            <asp:Parameter Name="图片" Type="String" />
            <asp:Parameter Name="价格" Type="Double" />
            <asp:Parameter Name="商品类型" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="商品名称" Type="String" />
            <asp:Parameter Name="数量" Type="Int32" />
            <asp:Parameter Name="图片" Type="String" />
            <asp:Parameter Name="价格" Type="Double" />
            <asp:Parameter Name="商品类型" Type="String" />
            <asp:Parameter Name="original_商品编号" Type="String" />
            <asp:Parameter Name="original_商品名称" Type="String" />
            <asp:Parameter Name="original_数量" Type="Int32" />
            <asp:Parameter Name="original_图片" Type="String" />
            <asp:Parameter Name="original_价格" Type="Double" />
            <asp:Parameter Name="original_商品类型" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>

